﻿#region << 文 件 说 明 >>
/*----------------------------------------------------------------
// 文件名称：TestBillModel
// 创 建 者：杨程
// 创建时间：2022/2/7 12:44:25
// 文件版本：V1.0.0
// ===============================================================
// 功能描述：
//		
//
//----------------------------------------------------------------*/
#endregion

using SqlSugar;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vampirewal.Core.Attributes;
using Vampirewal.Core.Components;
using Vampirewal.Core.Interface;
using Vampirewal.Core.Models;
using Vampirewal.Core.SimpleMVVM;

namespace test.Model
{
    //[AddInotifypropertychangedinterface]
    [SugarTable("TestBillModel")]
    public class TestBillModel:BillBaseModel
    {
        public TestBillModel()
        {
            ListDetails = new List<TestDetailModel>();
            ListDetails2 = new List<TestDetailModel2>();
        }

        private string _BillName;
        [SugarColumn(IsNullable = true,DefaultValue ="")]
        //[ExportExcelProperty(SortId = 2)]
        public string BillName
        {
            get { return _BillName; }
            set { _BillName = value;OnPropertyChanged(); }
        }


        private List<TestDetailModel> _ListDetails;
        [SugarColumn(IsIgnore = true)]
        public List<TestDetailModel> ListDetails
        {
            get { return _ListDetails; }
            set { _ListDetails = value; OnPropertyChanged(); }
        }

        private List<TestDetailModel2> _ListDetails2;
        [SugarColumn(IsIgnore = true)]
        public List<TestDetailModel2> ListDetails2
        {
            get { return _ListDetails2; }
            set { _ListDetails2 = value; OnPropertyChanged(); }
        }

    }
    [SugarTable("TestDetailModel")]
    public class TestDetailModel : DetailBaseModel
    {
        private string _DetailName;
        [SugarColumn(IsNullable = true)]
        public string DetailName
        {
            get { return _DetailName; }
            set { _DetailName = value; OnPropertyChanged(); }
        }

        private string _CC;

        public string CC
        {
            get { return _CC; }
            set { _CC = value; OnPropertyChanged(); }
        }

    }

    public class TestDetailModel2 : DetailItemChangeBaseModel<testDetailModel2DTO>
    {

        public TestDetailModel2(testDetailModel2DTO dto) :base(dto)
        {
            
        }

        private string _DName;
        [ListenDetailChange]
        public string DName
        {
            get { return _DName; }
            set { _DName = value; OnPropertyChanged(); }
        }



        private bool _IsDelete=false;
        public bool IsDelete { get=> _IsDelete; set { _IsDelete=value; OnPropertyChanged(); } }

        public override void LoadDTO(testDetailModel2DTO dto)
        {
            this.DName = dto.DName;
            this.IsDelete= dto.IsDelete;
        }
    }

    public partial class testDetailModel2DTO:NotifyBase
    {        
        public string DName { get; set; }

        public bool IsDelete { get; set; }

        [DoNotifyProperty]
        private string haha;
    }
}
